//
//  FDNetworkTool.m
//  FastDoctor
//
//  Created by MyMacbookPro on 16/5/3.
//  Copyright © 2016年 MyMacbookPro. All rights reserved.
//

#import "FDNetworkTool.h"

@implementation FDNetworkTool

+ (instancetype)sharedManager {
    return [[self alloc] init];
}

static FDNetworkTool *instance = nil;
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [super allocWithZone:zone];
    });
    return instance;
}

- (instancetype)init {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [super init];
        // 添加额外支持的解析数据格式
        NSMutableSet *set = [NSMutableSet setWithSet:instance.responseSerializer.acceptableContentTypes];
        [set addObject:@"text/html"];
        instance.responseSerializer.acceptableContentTypes = set;
        // 设置请求参数拼接序列化格式为JSON
        instance.requestSerializer = [AFJSONRequestSerializer serializer];
    });
    return instance;
}

- (id)copyWithZone:(NSZone *)zone {
    return self;
}

@end
















